Detangle the restart/reboot/halt/save/restore code. There is now one point
for management of shutdown state, XendDomainInfo.refreshShutdown, which is
able to cope whatever the current state of the domain. This fixes bug #124:
running reboot within a domU doesn't bring the domain back up after shutdown,
and bug #256: "xm reboot" could not make domU reboot.
Fix the refreshing inside XendDomain to ensure that the values returned by xm
list reflect reality correctly. We were removing XendDomainInfo instances,
but not creating them on start-up, so if xend were restarted, domain
information was being lost.
Merge XendDomain.dom0_unknown and initial_refresh into
XendDomainInfo.recreate.
Catch exceptions inside callInfo, and reraise them as XendErrors.
Remove unused XendDomain.close.
Further improvements are needed to XendDomainInfo to ensure that it avoids all
race conditions on shutdown, and can cope correctly with xend restarting
during a shutdown.
Add helper method XendDomain.callInfo that stubs through into XendDomainInfo.
This is used to remove much of the code duplication in the public methods there.
Move ImageHandler registration into image.py from XendDomainInfo.py. Move
ImageHandler.create and findImageHandlerClass to the module level, and inline
addImageHandlerClass. Move ImageHandler.kernel, ramdisk, cmdline, and flags,
which seem inadvertently to have been declared as class variables, and make
them instance variables instead.
Update User's Guide installation section to mention hotplug.
Now that hotplug seems to be necessary to boot new domains (at least, to
get disk access in those domains), add a note to the installation guide
mentioning this dependency.
Signed-off-by: Michael Vrable <mvrable@cs.ucsd.edu>
The hotplug subsystem is currently needed for block devices to work, as
of changeset 6742:e9d01c5dc7b4d6b7cda9ade0d137ddb89bb204cc. Add a
script to check for the presence of hotplug and warn if it isn't found.
Signed-off-by: Michael Vrable <mvrable@cs.ucsd.edu>
Merge the duplicated code for create, destroy, migrate, sysrq, and shutdown
into one handler that dynamically imports the correct subcommand handler.
Remove the fullhelp cruft, which was referencing something not actually present,
and was unused. Remove xm_network_attach and xm_network_detach, which were
providing code for unadvertised and unsupported functionality.
Move ImageHandler.create call to initDomain, after the call to xc.domain_create.
This ensures that ImageHandler has the correct domain ID available to it, which
seems sensible in general, and is necessary for the VMX VNC support in
particular.
Add check for speed (takes 33 minutes on my laptop, OUCH!)
Make xenstored use tdb, transactions can soft-fail (EAGAIN)
Transactions no longer take root dir, no longer lock & block: commit can fail spuriously with EAGAIN, not ETIMEDOUT.
Speeds up transactions by over 1000 times, should be NFS safe.
New program: xs_tdb_dump to dump raw TDB contents.
Don't do failure testing: we are no longer robust against all ENOMEM 8(
Introduce "struct node" which contains perms, children and data.
Make struct xs_permissions unpadded, so we can write to tdb w/o valgrind complaints.
Gently modify TDB to use talloc, not do alloc on tdb_delete.
Fix up transaction users for new semantics.
Don't need a transaction around a single read in xen/i386/kernel/smpboot.c.
Python: transaction_start() returns True/False rather than raising exception on EAGAIN.
Fix usage comment on xs_transaction_end().
Include stdarg to xs_tdb_dump so it compiles.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell [Fri, 23 Sep 2005 13:25:01 +0000 (14:25 +0100)]
Make xenstored use tdb, transactions can soft-fail (EAGAIN)
Transactions no longer take root dir, no longer lock & block: commit can fail spuriously with EAGAIN, not ETIMEDOUT.
Speeds up transactions by over 1000 times, should be NFS safe.
New program: xs_tdb_dump to dump raw TDB contents.
Don't do failure testing: we are no longer robust against all ENOMEM 8(
Introduce "struct node" which contains perms, children and data.
Make struct xs_permissions unpadded, so we can write to tdb w/o valgrind complaints.
Gently modify TDB to use talloc, not do alloc on tdb_delete.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Move initDomain out of image.py and into XendDomainInfo. The only thing that
needed any of the state of image.py was the bootloader code, which says there,
but all the rest was doing something that belonged more properly in
XendDomainInfo, with all the other generic domain initialisation code.
Added diagnostic message when RuntimeError is raised inside XenStore.exists.
This is one of the first things to be used when xenstored starts up, so a
corrupted filesystem may manifest itself here.
A number of changes to get save-restore working again:
Fix the use of configuration inside domain_configure. The config written by
XendDomainInfo.sxpr has moved, and this function needs to change to match.
Re-add a call to _add_domain inside domain_restore.
Inside XendDomainInfo.restore, perform the appropriate configuration to restore
the domain.
Validate maxmem_KiB, and cap it at memory_KiB if over that value. Save
requires that value to be correct, as the logic for saving only the pages
in use is not in place inside Xen.
Output the device configuration in sxpr(), as required for save-restore.
Check for image being null when trying to call createDeviceModel -- configure
is called on restore as well as create, and the ImageHandler instance is not
present in the former.
Remove all CONFIG_VTI, VTI now works dynamically
1.remove vcpu_set_regs and element regs,which are never used
2.remove ia64_prepare_handle_privop,ia64_prepare_handle_break, ia64_prepare_handle_reflection, which are never used.
3.modify related macros for adapting to three level physical to machine table
4.remove all CONFIG_VIT
5.merge ia64_switch_to
This patch adds a check in xend that prevents a user from trying to
destroy Dom0. Currently, xm does not return an error for this case.
Xend tries to destroy dom0 and leaves the system in an unstable
state. Subsequent attempts to create a domain result in the following
error message:
this patch fixes the bug that when "cpu" is not set in config file,
control panel complains "Error creating domain - int argument required". Signed-off-by: Xin Li <xin.b.li@intel.com>
This fixes the "make check" feature of xenstore to properly compile with
x86-64. When compiling you would get the following error since on x86-64
it was passing a long , when you are expecting an int.
This patch fixes a bug where raise_softirq(SCHEDULE_SOFTIRQ) is called
upon a hlt instruction from a VMX guest, causing repeated VMExits when
the guest is idle. At the same time, it disables the monitor/mwait
feature as it's not feasible to implement for vcpu.
Signed-off-by: Xiaofeng Ling <xiaofeng.ling@intel.com> Signed-off-by: Asit Mallick <asit.k.mallick@intel.com> Signed-off-by: Jun Nakajima <jun.nakajima@intel.com>
Fix mapping of shared ring pages into backend drivers.
This should fix observed problems when creating a domain,
causing Xen to print "Could not find PTE entry for
address ...".
Split the configuration file parsing and xc dominfo parsing aspects of
XendDomainInfo out from the rest of the code, creating an intermediate
dictionary of common format. This means that the rest of XendDomainInfo can
work whether creating a domain for the first time, or whether xend is
restarted but the domains still exist. This means that xend is now robust in
the face of restarts. The phase of validation of configuration details is
now more explicit, and stronger too.
Change the handling of memory sizes in XendDomainInfo's interface to use KiB
in setMemoryTarget and getMemoryTarget. This gives reasonable granularity
whilst ensuring that we can handle values up to 2TiB without overflowing a
signed 32 bit value. It is not clear that the xend code, especially the C /
Python interface, is either 64-bit clean or unsigned 32-bit clean, so this is
the safest choice for now. The behaviour of Python's shift operator will
change in Python 2.4, so it is best to address this problem once we have moved
to that version.
Determine the backend flags on-the-fly, in getBackendFlags, rather than
computing them in advance in configureBackends and storing the value. Change
addControllerClass so that backend flag information is in this table too,
rather than hard-coded elsewhere.
Improve the error reporting for name clashes.
Remove XendDomainInfo's dependence upon DBMap, and use xstransact directly
instead. This changes the interface from XendDomain to XendDomainInfo, as
paths rather than DBMaps are passed in.
Remove the XendDomainInfo.recreate and restore flags. Since the device and
domain handling is now stateless inside xend, much less work is necessary for
recreate and restore procedures, so we can do without these flags.
Remove XendDomainInfo's unused dependency upon SrvDaemon, and its unnecessary
dependence upon PrettyPrint. Remove the unused show method.
Decouple image.py from XendDomainInfo.bootloader by passing a bootloading flag
into initDomain instead. Decouple it from XendDomainInfo.config by passing
the semiparsed device configuration into create(). Move configuration in
VmxImageHandler so that rather than being scattered around the class it is in
or called from the configure method. Device configuration is no longer
available anywhere else.
From Dan Smith <danms@us.ibm.com>:
I could not find in the existing code the point at which
a domain was added to the XendDomain list after restore. Several
attempts to restore would result in positive log messages, but the
restored domain would not show up in "xm list". This patch includes a
call to _add_domain(), which results in restore working for me.
Added diagnostic messages to the RuntimeError exceptions when they occur inside
_read and _write. Fix gather to not return the string 'None' when reading a
value of type string that does not exist. The value None should be returned
instead.
Lots of minor changes to please pylint, including matching the number of
parameters between functions in the base classes and those that override them
in subclasses. It's hard to see how this code worked at all.
On one of pyxc_domain_getinfo's error paths, free the block allocated
previously. This would have caused a memory leak when attempting to get info
on a domain that does not exist.
Get multiple domains working again
Signed-off-by Kevin Tian <kevin.tian@intel.com>
Some interesting issues found related to two small patches:
1. Only "xm console 1" and "Ctrl + ]" can make xenU forward progress,
and however still failed to connect blkback later.
[Reason] Previous event injection on XEN/IPF only set vIRR bit
when evtchn_set_pending. However with the latest xenlinux code, it's
possible for xenlinux to set pending indication and selector when
unmasking some pending event channel. This path has nothing to do with
vIRR bit.
[Solution] We should check event pending every time when
checking pending interrupts before returning to guest.
2. After fixing first issue, nested event is injected when first event
is still in handle with lock held. Then dead lock happens at end of
"xend start".
[Reason] Due to same logic as above, xenlinux may set pending
indication and re-trigger pending event by force_evtchn_callback. On
x86, this stub just does a dummy xen_version hypercall and pending event
will be injected back when leaving hypervisor. However on IA64,
force_evtchn_callback is incautiously made invoking evtchn_interrupt()
directly, while the former may be called with lock held.
[Solution] Just let force_evtchn_callback as empty for simple now.
domain_setmaxmem takes an int, not a long, for the maxmem_kb parameter. The
underlying xc_domain_setmaxmem already took an unsigned int, and
PyArg_ParseTupleAndKeywords call was only parsing an int, so there is no way
that longer values would get through here in any case. Fixing the documentation
and the local variable is the best solution, until someone decides that we need
to support maxmem values greater than 2TiB.
Add support to build arch/ia64 xen kernels, also add pre/post link hooks in mkbuildtree. Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
Add 64 bit support to the VTPM Tools plus do some minor cleanups.
The VTPM manager and VTPMs fully support both 32 and 64 bit OSes. The
tpm_emulator (provided for debugging on TPM-less machines) does not
support 64-bit kernels by default though. See the README for details on
how to use it on 64-bit kernels.
Dynamically generate the local apic entries in ACPI MADT table.
The number of local apic entries is decided by the #vcpus passed
from the config file (eg./etc/xen/xmexample.vmx).
This feature is required by the SMP VMX domain.
Signed-off-by: Ke Yu <ke.yu@intel.com> Signed-off-by: Xin Li <xin.b.li@intel.com> Signed-off-by: Asit Mallick <asit.k.mallick@intel.com>
Merge vcpu phase 2
Signed-off-by Anthony Xu <Anthony.xu@intel.com>
1. Add r4,r5,r6,r7,eml_unat,rfi_pfs six members at the end of pt_regs,
thus VMM for non-VT domain doesn't need to save/restore SWITCH_STACK
just in case VMM may need modify guest r4,r5,r6,r7 value, eml_unat is saved
in case VMM may need modify guest unat, rfi_pfs is used to emulate guest rfi
instruction for VT domain, and is used as dummy member for alignment of F6,
F7 etc. in pt_regs for non-VT domain. And add code to save/restore r4,r5,r6,
r7,eml_unat in minstate.h and entry.s for non-VT domain. and remove code to
save/restore SWITCH_STACK in ivt.S for non-VT domain.
2. Originally guest banked registers of VT domain are saved directly in VPD. Now
Guest banked registers of VT domain are saved to pt_regs at the entry of VMM,
just for consistence with non-VT domain, vmx_vcpu_bsw0 and vmx_vcpu_bsw1 are
rewriten for accomodating this change.
3. After above changes, all guest registers and nat bits are saved at same place
both for VTI domain and for non-VTI domain, so vcpu_get/set_gr and rse_get/set_gr
are merged, and all these functions can handle guest nats.
4. Merged vcpu_bsw0 and vcpu_bsw1, Now VMM used vgr[16],vbgr[16],vnat,vbnat in mapped_regs_t
struct (is also vpd) to emuate guest banking switch operation.
5. Removed some CONFIG_VTIs and cleaned up some unused structure members and codes.
Note: Credit accidentally omitted from merge vcpu phase 1, included here:
This patch is based on ver 6723. And definitely I can boot dom0 with this patch.
Following things are done in this patch.
1. Merge structure pt_reg.
2. Though vcpu_info structure has been merged, non-vt domain used pointer
vcpu->vcpu_info->arch.privregs, and vt domain used pointer
vcpu->arch.arch_vmx.vpd, the value of these two pointers are different,
that means vt and non-vt domain still use different privileged registers
pages, in this case, we can't merge vcpu.c, so I merged these two pointer,
and put it at vcpu->arch.privregs. vcpu->vcpu_info->arch.privregs and
vcpu->arch.arch_vmx.vpd will not exist. Why put it at vcpu->arch.privregs?
1. There will be one less pointer unreferenced when accessing this
privileged registers page.
2. vcpu->vcpu_info can be accessed by guest, but guest can't access
privileged registers page through this address, guest can access
this privileged page only through another special mapping. So there
is no need to expose this pointer to guest by putting it in
vcpu->vcpu_info structure. All accesses to this page is through
VCPU(vcpu,y) macro,
3. Merged following functions.
Vcpu_set/get_(interruption control registers from cr16 to cr25),
corresponding functions vmx_vcpu_set/get_*** will not exist.
Vcpu->arch.arch_vmx.in_service[4] will not exist, we will all use
vcpu->arch.insvc[4]
4. Cleaned up some unused structure members and codes.